const router = require('koa-router')()
const fs = require('fs')
const path = require('path')
const send = require('koa-send')
const config = require('../public/javascripts/config')

router.prefix('/download')

router.get('/', async(ctx,next)=>{
  var fileName = config.apkName;
  ctx.attachment(fileName)
  const fileDir = path.join(__dirname,'../apk')
  await send(ctx,fileName,{root:fileDir})
})

module.exports = router;
